package com.soulkun.smarthome.ui.main.personal.adapter

import android.content.Context
import android.view.View
import androidx.databinding.ObservableArrayList
import androidx.databinding.ObservableBoolean
import androidx.databinding.ViewDataBinding
import com.soulkun.smarthome.R
import com.soulkun.smarthome.databinding.AppRecycleItemMainPersonalFamilyRoomRoomListBinding
import com.soulkun.smarthome.logic.model.RoomModel
import com.soulkun.smarthome.logic.vo.RoomVO
import soulkun.library.mvvm.adapter.BaseDataBindingRecyclerViewAdapter

class AppMainPersonalFamilyRoomRoomListAdapter(
    context: Context,
    modelList: ObservableArrayList<RoomVO>,
    private val managerStatus: ObservableBoolean,
    private val onClickListener: (ViewDataBinding) -> View.OnClickListener
) :
    BaseDataBindingRecyclerViewAdapter<RoomVO>(context, modelList) {

    override fun getContentLayoutResId(): Int {
        return R.layout.app_recycle_item_main_personal_family_room_room_list
    }

    override fun setContentViewHolderCreateListener(binding: ViewDataBinding) {
        (binding as AppRecycleItemMainPersonalFamilyRoomRoomListBinding).onClickListener =
            onClickListener(binding)
    }

    override fun setContentViewHolderBindListener(binding: ViewDataBinding, dataPosition: Int) {
        (binding as AppRecycleItemMainPersonalFamilyRoomRoomListBinding).roomVO =
            dataList[dataPosition]
        binding.managerStatus = managerStatus
    }

}